import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;


public class ChoclateCounter {

	public static void main(String[] args) {
		InputReader inputReader = new InputReader("C:\\sivravis\\dev\\studies\\Algorithms\\Hackerrank\\input01.txt");
		List inputValues = inputReader.readFile();
		inputReader.close();
		
		OutputReader outputReader = new OutputReader("C:\\sivravis\\dev\\studies\\Algorithms\\Hackerrank\\output01.txt");
		List outputValues = outputReader.readFile();
		outputReader.close();	
		
		List incorrectList = new ArrayList();

		Solution solution = new Solution();
		int outputCount=0;
		for (Iterator iterator = inputValues.iterator(); iterator.hasNext();) {
			int[] inputs = (int[]) iterator.next();
			System.out.println("            " + inputs[0] + " " + inputs[1] + " " + inputs[2]);
			
			int amount = inputs[0], rate=inputs[1], wrapperExchangeCount=inputs[2];
			int numberOfChoclates = solution.getNumberOfChoclates(amount,rate);
			int choclateCount = numberOfChoclates + solution.getChoclateForWrappers(numberOfChoclates,wrapperExchangeCount);
			int outputValue = Integer.valueOf(outputValues.get(outputCount).toString());
			
			System.out.print((outputCount++) +". Expected value = " +outputValue + " Actual Value " + choclateCount);
			
			if(outputValue == choclateCount){
				System.out.println(" Correct");
			}	else {
				System.out.println(" InCorrect");
				incorrectList.add(inputs);
			}
			System.out.println();
		}
		
		for (Iterator iterator = incorrectList.iterator(); iterator.hasNext();) {
			int[] inputs = (int[]) iterator.next();
			System.out.println("            " + inputs[0] + " " + inputs[1] + " " + inputs[2]);
			
		} 
	}

}
